INCLUDEDIR = -I../lib/include
CFLAGS = -nostdinc -nostdlib -nostartfiles -fno-builtin -fwritable-strings -Wall -W -g
LIBDIR = ../lib
CC=gcc-3.3
ENTRY = _crt0
RELOC = 0x00001020
CRT   = $(LIBDIR)/crt0.o 
LIBC  = $(LIBDIR)/libc.a 
BUNDLE = bundle.sfs
IMPORTER = sfs_import
all: hello bundle
hello: hello.c
	$(CC) -c $(CFLAGS) $(INCLUDEDIR) hello.c
	objcopy -R .comment hello.o
	ld -T linker.ld -Ttext $(RELOC) --entry $(ENTRY) -L$(LIBDIR) -S -o hello $(CRT) hello.o $(LIBC) --warn-common -nostdlib
bundle: 
	./stuffer -b $(BUNDLE) $(IMPORTER)
debug:
	ld -T linker-dbg.ld -Ttext 0x1020 --entry $(ENTRY) -L$(LIBDIR) -o hello-dbg $(CRT) hello.o $(LIBC) --warn-common
clean:
	rm -f $(BUNDLE) hello hello.o hello-dbg
